package com.fz.consumer.listeners;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class MqListener3 {
    @RabbitListener(bindings = @QueueBinding(
        value = @Queue(name = "topic7.queue1"),
        exchange = @Exchange(name = "hmall.topic7",type = ExchangeTypes.TOPIC),
        key = {"china.#"}
    ))
    public void listenTopicQueue71(String msg) {
        log.info("消费1接收到topic7.queue1的消息：{}", msg);
    }

    @RabbitListener(bindings = @QueueBinding(
        value = @Queue(name = "topic7.queue2"),
        exchange = @Exchange(name = "hmall.topic7",type = ExchangeTypes.TOPIC),
        key = {"#.news"}
    ))
    public void listenTopicQueue72(String msg) {
        log.info("消费1接收到topic7.queue2的消息：{}", msg);
    }
}
